﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Financiera
{
    public partial class Form_menu : Form
    {
        public string rutaBDD;
        public string fecha;

        public Form_menu()
        {
            InitializeComponent();
        }

        private void Form_menu_Load(object sender, EventArgs e)
        {
            
            Conexion.fecha_d=txt_dia.Text = DateTime.Now.Day.ToString();
            Conexion.fecha_m=txt_mes.Text = DateTime.Now.Month.ToString();
            Conexion.fecha_a=txt_año.Text = DateTime.Now.Year.ToString();
        }

        private void btn_modif_Click(object sender, EventArgs e)
        {
            if (txt_dia.Enabled == true)
            {
                txt_dia.Enabled = false;
                txt_mes.Enabled = false;
                txt_año.Enabled = false;
            }
            else
            {
                txt_dia.Enabled = true;
                txt_mes.Enabled = true;
                txt_año.Enabled = true;
            }
            Conexion.fecha_d = txt_dia.Text; 
            Conexion.fecha_m = txt_mes.Text;
            Conexion.fecha_a = txt_año.Text;
        }

        private void btn_cargaBDD_Click(object sender, EventArgs e)
        {
            OpenFileDialog abreBDD = new OpenFileDialog();
            if (abreBDD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {

                rutaBDD = abreBDD.FileName.ToString();
                Conexion.rutaDB = rutaBDD;
                ///--------COMENTALE ESTO!!!!
            
                //Conexion.rutaDB = @"Data Source=.\SQLExpress;AttachDbFilename=" + rutaBDD + ";Integrated Security=True;Connect Timeout=30;User Instance=True";
                //Conexion.rutaDB = @"Data Source=.\\SQLExpress;AttachDbFilename=" + rutaBDD + ";Integrated Security=True;User Instance=True";
            }
            txtPruebaBDD.Text = rutaBDD;
         
            Conexion.ds_financiera = new DataSet();
        }

        private void btn_cliente_Click(object sender, EventArgs e)
        {
            Form_Clientes frm = new Form_Clientes();
            frm.Show();
        }

        private void btn_operaciones_Click(object sender, EventArgs e)
        {
            Form_operaciones frm= new Form_operaciones();
            frm.Show();
        }

        private void btn_moneda_Click(object sender, EventArgs e)
        {
            Form_Moneda frm = new Form_Moneda();
            frm.Show();
        }

        private void btn_caja_Click(object sender, EventArgs e)
        {
            Form_Caja frm = new Form_Caja();
            frm.Show();
        }

        private void btnGastos_Click(object sender, EventArgs e)
        {
            Form_Gastos frm = new Form_Gastos();
            frm.Show();
        }

        private void btnPlanilla_Click(object sender, EventArgs e)
        {
            Form_Planilla_Manual frm = new Form_Planilla_Manual();
            frm.Show();
        }
    }
}

